﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GoodBrandClass.aspx.cs"
    Inherits="Enter.Web.SystemAdmin.GoodClass.GoodBrandClass" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function selectCheck() {
            var els = event.srcElement; //获取当前事件的对象
            if (els.type == 'checkbox') {
                var divId = els.id.replace('CheckBox', 'Nodes'); //获取子节点的层Id
                var divObj = document.getElementById(divId); //获取层对象
                if (divObj == null) return;
                var checkBoxs = divObj.getElementsByTagName('input'); //获取层下所有input 控件
                for (var i = 0; i < checkBoxs.length; i++) {
                    if (checkBoxs[i].type == 'checkbox') //控件为checkbox
                    {
                        checkBoxs[i].checked = els.checked; //设置复选框状态
                    }
                }
            }
        }

        function DeptAll() {
            var obj = document.getElementById("chk_DropAll");

            var arr = document.getElementById("div_Drop").getElementsByTagName("INPUT");

            for (i = 0; i < arr.length; i++) {
                if (arr[i].type == "checkbox") {
                    arr[i].checked = obj.checked;

                }
            }
        }
        function SorAll() {
            var obj = document.getElementById("chk_SortAll");

            var arr = document.getElementById("div_SortAll").getElementsByTagName("INPUT");

            for (i = 0; i < arr.length; i++) {
                if (arr[i].type == "checkbox") {
                    arr[i].checked = obj.checked;

                }
            }
        } 
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div>
            <asp:DropDownList ID="rp_Data" runat="server" AutoPostBack="True" OnSelectedIndexChanged="rp_Data_SelectedIndexChanged">
            </asp:DropDownList>
            <input id="chk_SortAll" onclick="SorAll()" type="checkbox" />全选
        </div>
        <div>
            <div id="div_SortAll" style="float: left; width: 30%">
                <asp:TreeView ID="tvGivePop" NodeWrap="true" runat="server" ShowCheckBoxes="All"
                    ShowLines="True" onclick="selectCheck()" Width="100%" ExpandDepth="1">
                </asp:TreeView>
            </div>
            <div id="Brand" style="float: left; width: 50%">
                <asp:CheckBoxList ID="CheckBoxList1" RepeatDirection="Horizontal" RepeatColumns="5" DataTextField="BName" DataValueField="BNO" runat="server">
                </asp:CheckBoxList>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
